package com.xsr.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;

/**
 * @author 邢式瑞
 * @version 1.0
 * @project gp14Sm
 * @date 2022/9/9 22:00
 */
public class User {
    @JSONField(name="old_name")
    private  String name;
    @JSONField(serialize = false)//忽略属性
    private  Boolean gender;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;
    @JSONField(serialzeFeatures = SerializerFeature.WriteMapNullValue)
    private  String[] hobby;
    private BigDecimal salary;
@JSONField(serializeUsing = MySerialize.class)
    public BigDecimal getSalary() {
        return salary;
    }

    public void setSalary(BigDecimal salary) {
        this.salary = salary;
    }

    public User(String name, Boolean gender, Date birthday, String[] hobby, BigDecimal salary) {
        this.name = name;
        this.gender = gender;
        this.birthday = birthday;
        this.hobby = hobby;
        this.salary = salary;
    }

    public User(String name, Boolean gender, Date birthday, String[] hobby) {
        this.name = name;
        this.gender = gender;
        this.birthday = birthday;
        this.hobby = hobby;
    }

    public User() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getGender() {
        return gender;
    }

    public void setGender(Boolean gender) {
        this.gender = gender;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String[] getHobby() {
        return hobby;
    }

    public void setHobby(String[] hobby) {
        this.hobby = hobby;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", gender=" + gender +
                ", birthday=" + birthday +
                ", hobby=" + Arrays.toString(hobby) +
                '}';
    }
}
